    var actInd = Titanium.UI.createActivityIndicator({
        message: "Contacting DNN site"
    });
    actInd.show();
    // Create variable "win" to refer to current window
    var win = Titanium.UI.currentWindow;

    // Function loadRoles()
    function loadRoles() {
        // Empty array "rowData" for our tableview
        var rowData = [];
        // Create our HTTP Client and name it "loader"
        var loader = Titanium.Network.createHTTPClient();
        // Sets the HTTP request method, and the URL to get data from
        loader.open("GET", "http://192.168.1.65/dnndev/svc/roles");
        // Runs the function when the data is ready for us to process
        loader.onload = function() {

            actInd.hide();
            var roleData = eval('(' + this.responseText + ')');


            for (var i = 0; i < roleData.Roles.length; i++) {
                var roleName = roleData.Roles[i].RoleName; // The role name
                var roleDescription = roleData.Roles[i].Description; // The descritpion of role

                // Create a row and set its height to auto
                var row = Titanium.UI.createTableViewRow({ height: 'auto' });

                // Create the view that will contain the text and avatar
                var post_view = Titanium.UI.createView({
                    height: 'auto',
                    layout: 'vertical',
                    top: 2,
                    right: 2,
                    bottom: 2,
                    left: 2
                });
                // Create the label to hold the role name
                var roleName_lbl = Titanium.UI.createLabel({
                    text: roleName,
                    font: { fontSize: 24, fontWeight: 'bold' },
                    width: 'auto',
                    textAlign: 'left',
                    top: 0,
                    left: 15,
                    height: 32
                });
                post_view.add(roleName_lbl);

                // Create the label to hold the roleDescription
                var roleDescription_lbl = Titanium.UI.createLabel({
                    text: roleDescription,
                    font: { fontSize: 12, fontWeight: 'bold' },
                    width: 'auto',
                    textAlign: 'left',
                    top: 1,
                    left: 20,
                    height: 20
                });
                post_view.add(roleDescription_lbl);
                // Add the post view to the row
                row.add(post_view);
                // Give each row a class name
                row.className = "item" + i;
                // Add row to the rowData array
                rowData[i] = row;
            }
            // Create the table view and set its data source to "rowData" array
            var tableView = Titanium.UI.createTableView({ data: rowData });
            //Add the table view to the window
            win.add(tableView);
        };
        // Send the HTTP request
        loader.send();
    }
    loadRoles();